package com.consumer.controller;


import com.consumer.client.ProducerFeign;
import com.consumer.entity.UserEneity;
import javafx.fxml.Initializable;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;

@RestController
@RequestMapping("/user")
@RefreshScope
public class ConsumerUserController  {




    @Resource
    private ProducerFeign requestFeign;
    @GetMapping("/getUserAll")
    public ResponseEntity<List<UserEneity>> getUserAll(){
        List<UserEneity> all = requestFeign.getAll();
        return ResponseEntity.ok(all);
    }




    @Value("${name.config}")
    private String name;
    public void setName(String name) {
        this.name = name;
    }


    @GetMapping("/testConfig")
    public ResponseEntity<String> testConfig(){
        return ResponseEntity.ok(name);
    }


}
